home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / dbms_mag / 9103 / lastlog / addid.c next >
C/C++ Source or Header  |  1991-02-17  |  2KB  |  63 lines

  1. /*****************************************************************
  2. *  AddID.C
  3. *  written by Kathy Cea, Platinum Software Int'l
  4. *
  5. *  Allows a supervisor to assign an application-specific
  6. *  user id for a given network user.  Stores the id in the bindery as a
  7. *  property which can later be verified using the VerID program.
  8. *  AddID can also be used to change the application-specific user id.
  9. *
  10. *  Calling Syntax:
  11. *   AddID <user-network-id> <appl-id> <user-id>
  12. *     where <user-network-id> is the user's network (login) id
  13. *           <appl-id> is a name assigned to the application (max 12 chars)
  14. *           <user-id> is the user's id for the application (acts like a
  15. *                     password)
  16. *
  17. *   Compiled in Turbo C 2.0 with NetWare C function calls
  18. *****************************************************************/
  19.  
  20. #include <stdio.h>
  21. #include <nit.h>
  22. #include <niterror.h>
  23.  
  24. char objectName[48];
  25. char propertyName[16];
  26. char applName[13];
  27. BYTE propertyFlags= 0; /* Static, Item */
  28. BYTE propertySecurity = 0x32; /* Supervisor write, Object read */
  29. BYTE propertyValue[128];
  30. BYTE moreSegments = 0;
  31. int retcode;
  32.  
  33. main(int argc, char *argv[])
  34. {
  35.    if(argc < 4) {
  36.         printf("Too few parameters supplied\n");
  37.         exit(1);
  38.     }
  39.     strcpy(objectName, strupr(argv[1]));
  40.     strcpy(applName,strupr(argv[2]));
  41.     strcpy(propertyValue,strupr(argv[3]));
  42.     /* To enforce conformity, we'll append "ID" to the end of the
  43.        application name stored in the bindery */
  44.     strcpy(propertyName,applName);
  45.     strcat(propertyName,"ID");
  46.  
  47. /* Add the property (application name) for the user */
  48.     retcode = CreateProperty(objectName,OT_USER,propertyName,
  49.                 propertyFlags,propertySecurity);
  50. /* Assign the property value (application-specific userid) */
  51.     if (retcode == SUCCESSFUL || retcode == PROPERTY_ALREADY_EXISTS) {
  52.         retcode = WritePropertyValue(objectName,OT_USER,propertyName,
  53.                     1,propertyValue,moreSegments);
  54.         if (retcode == SUCCESSFUL)
  55.             printf("Successful\n");
  56.         else
  57.             printf("Unable to assign value\n");
  58.     }
  59.     else
  60.         printf("Unable to assign property\n");
  61. }
  62.  
  63.